package com.ziytek.web.citizen.enums;

import com.ziytek.web.citizen.service.itf.StepAddResponse;
import lombok.Getter;

/**
 * @author fenghx
 * @version 1.0
 * @className StepEnum
 * Description:
 * @date 2024/3/15 13:24
 */
@Getter
public enum SchmeEnum implements StepAddResponse {
    /**
     * Description: 工步方案保存返回信息
     */
    SUCCESS("0", "成功"),
    LIST_COUNT_OUT("97", "分容等级设置数量上限不能大于100"),
    NAME_NOT_EXIST("98", "分容方案名不能为空"),
    OBJECT_NOT_EXIST("99", "分容方案不存在"),
    PARAMETER_ERROR("101", "参数异常"),
    SET_LIST_EMPTY("102", "分容等级设置列表不能为空"),
    SET_LIST_ERROR("103", "分容设置列表配置不正确"),
    ADD_ERROR("104", "分容方案新增失败"),
    MODIFY_ERROR("01040", "分容方案编辑失败"),
    SET_LIST_DATA_ERROR("001", "分容同一等级起始大于结束值"),
    SET_LIST_DATA_ERROR_TWO("002", "分容等级参数设置交叉"),
    NAME_ERROR("008", "新增方案名称不能重复"),
    UPDATE_NAME_ERROR("009", "方案名称已存在"),
    UPDATE_NO_ERROR("010", "方案编号已存在"),

    CCV_ERROR("105", "恒流恒压充电工步设置参数不正确"),
    CC_ERROR("106", "恒流充电工步设置参数不正确"),
    CV_ERROR("107", "恒压充电工步设置参数不正确"),
    CCD_ERROR("108", "恒流放电工步设置参数不正确"),

    SCHME_ISSUED_ID_ERROR("109", "参数异常,主键不能为空"),
    SCHME_ISSUED_NO_ERROR("110", "参数异常,机柜编号不能为空"),
    SCHME_ISSUED_NOT_EXIST("111", "分容设置方案不存在"),
    SCHME_ISSUED_LIST_NOT_EXIST("112", "分容方案执行工步列表不存在"),
    SCHME_ISSUED_FAILED("113", "部分分容方案执行失败"),

    OTHER("201", "接口请求失败");

    public final String code;
    public final String desc;

    SchmeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public String getMsg(String code) {
        for (SchmeEnum sp : SchmeEnum.values()) {
            if (sp.getCode().equalsIgnoreCase(code)) {
                return sp.desc;
            }
        }
        return ResponseEnum.OTHER_ERROR.getDesc();
    }

    @Override
    public int getPosition(String code) {
        return 0;
    }
    @Override
    public String getCode(String line, int position) {
        return null;
    }
}
